﻿using System;
using System.Collections.Generic;
using NakedObjects;

namespace HRMDomain
{
    [Bounded]
    public class AbsenceStage : Base
    {

        public virtual AbsenceStageType Stage { get; set; }
        [Mask("d")]
        public virtual DateTime StartDate { get; set; }
        [Mask("d")]
        public virtual DateTime? EndDate { get; set; }
        public virtual Employee Employee { get; set; }
        #region Meetings (collection)
        private ICollection<Meeting> _Meetings = new List<Meeting>();

        public virtual ICollection<Meeting> Meetings
        {
            get
            {
                return _Meetings;
            }
            set
            {
                _Meetings = value;
            }
        }
        #endregion
        #region Notes (collection)
        private ICollection<Note> _Notes = new List<Note>();

        public virtual ICollection<Note> Notes
        {
            get
            {
                return _Notes;
            }
            set
            {
                _Notes = value;
            }
        }
        #endregion


        public string Title()
        {
            TitleBuilder t = new TitleBuilder();
            t.Append(Stage.Name);
            return t.ToString();
        }

        #region AddNote (Action)

        [MemberOrder(Sequence = "1")]
        public void AddNote([MultiLine]string Entry)
        {
            Note newNote = Container.NewTransientInstance<Note>();

            newNote.EnteredDate = DateTime.Now;
            newNote.Text = Entry;

            if (!(_Notes.Contains(newNote)))
            {
                _Notes.Add(newNote);
            }
        }

        // Use 'hide', 'dis', 'val', 'actdef', 'actcho' shortcuts to add supporting methods here.
        #endregion
    }
}
